package org.usmile.algorithms.huawei.acm;

import java.util.Arrays;
import java.util.Comparator;
import java.util.Scanner;
import java.util.StringJoiner;

// https://fcqian.blog.csdn.net/article/details/128366751
public class _预订酒店 {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

        int n = sc.nextInt();
        int k = sc.nextInt();
        int x = sc.nextInt();

        int[][] prices = new int[n][2];
        for (int i = 0; i < n; i++) {
            int price = sc.nextInt();
            prices[i][0] = price;
            prices[i][1] = Math.abs(price - x);
        }
        Arrays.sort(prices, (o1, o2) -> o1[1] == o2[1]? o1[0] - o2[0] : o1[1] - o2[1]);

        int[] result = new int[k];
        for (int i = 0; i < k; i++) {
            result[i] = prices[i][0];
        }
        Arrays.sort(result);

        StringJoiner sj = new StringJoiner(" ");
        for (int i = 0; i < k; i++) {
            sj.add(result[i] + "");
        }

        System.out.println(sj.toString());
    }
}
